package com.harboursoftware.xstorage


import com.harboursoftware.xstorage.db.sql.DatabaseProviderImpl;
import com.harboursoftware.xstorage.util.SQLScriptRunner 
import org.junit.Test

/**
 * 该类用于初始化测试数据库。
 * @author Simon Leung
 * @since 0.1
 */
class TestDatabaseProvider extends DatabaseProviderImpl {
    void recreateDatabase() {
        def sqlInput = TestDatabaseProvider.class.getResourceAsStream("/sql/mysql.sql")
        def sqlRunner = new SQLScriptRunner(sqlInput)
        def conn = TestDatabaseProvider.getInstance().getConnection()
       
        sqlRunner.runScript(conn, true)
     }
     
    
    TestDatabaseProvider() {}
}
